package com.atguigu.gulimall.seckill.scheduled;

import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.CompletableFuture;

/**
 * 开启定时任务
 */
@Slf4j
@Component
//@EnableAsync
//@EnableScheduling
public class HelloScheduled {
    /**
     * spring中6位组成，不允许第七位
     * 在周几的位置1-7表示周一到周日
     */
    @Async
    @Scheduled(cron = "* * * ? * 3")
    public void hello() throws InterruptedException {
        log.info("hello...");
        Thread.sleep(3000);
    }
}
